//
//  ViewController.m
//  FMSManagerDemo
//
//  Created by hongbao.cui on 14-11-10.
//  Copyright (c) 2014年 ___FULLUSERNAME___. All rights reserved.
//

#import "ViewController.h"
#import "FMSManager.h"
#import "ApplicationUtils.h"
@interface ViewController ()

@end

@implementation ViewController
//-(void)loadView{
//    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[UIScreen mainScreen].bounds];
//    self.view = scrollView;
//    [scrollView setContentSize:CGSizeMake(320.0, 568*2)];
//    [scrollView setBackgroundColor:[UIColor whiteColor]];
//}
-(void)textBtnClicked:(id)sender{
    
}
-(void)picBtnClicked:(id)sender{
    
}
-(void)draftBtnClicked:(id)sender{
    
}
- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.edgesForExtendedLayout = UIRectEdgeNone;
    [FMSManager shareInstance].fmsCtrll =  self;
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:17]};
//    [[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
//    [[UINavigationBar appearance] setTitleTextAttributes:attributes];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(IBAction)switchAction:(UISwitch *)sender{
//    NSLog(@"11111111");
//    if (sender.on) {
        NSString *ip_host = @"wangrun2014";
        [FMSManager shareInstance].offLineOrNot = 1;//每次都重新获取
        [[FMSManager shareInstance] showModelPaper:ip_host paperID:@"7217" Model:@"0"];//3416，6826，6280
        [FMSManager shareInstance].backBlock = ^(id result){
            NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:17]};
            [[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
            [[UINavigationBar appearance] setTitleTextAttributes:attributes];

//             [[UINavigationBar appearanceWhenContainedIn:[UIViewController class], nil] setBarTintColor:[UIColor redColor]];
        };
//    }else{
//        NSLog(@"试卷练习");
//        NSString *ip_host = @"wangrun2014";
//        [[FMSManager shareInstance] showModelPaper:ip_host paperID:@"20114" Model:@"1"];
//    }
}
//同步练习
-(IBAction)showSynExercise:(id)sender{
    NSString *ip_host = @"sdfsf";
    [[FMSManager shareInstance] showSynExercise:ip_host paperID:@"20114"];
}
//我的收藏
-(IBAction)myCollection:(id)sender{
    [[FMSManager shareInstance] showCollection];
}
//我的成绩
-(IBAction)myAchivement:(id)sender{
    [[FMSManager shareInstance] showAchivement];
}
//清除缓存,做题记录等
-(IBAction)clearCache:(id)sender{
    [[FMSManager shareInstance] clearCache];
}
//清除我的收藏
-(IBAction)clearMyCollection:(id)sender{
    BOOL success = [[FMSManager shareInstance] clearMyCollection];
    if (success) {
        NSLog(@"清除成功");
    }else{
        NSLog(@"清除失败");
    }
}
//清除我的成绩
-(IBAction)clearMyMark:(id)sender{
    BOOL success = [[FMSManager shareInstance] clearMyAchivement];
    if (success) {
        NSLog(@"清除成功");
    }else{
        NSLog(@"清除失败");
    }
}
@end
